class CreateEquivalentSubjects < ActiveRecord::Migration
  def self.up
    create_table :equivalent_subjects do |t|
      t.references :subject
      t.integer :equivalent_to_id

      t.timestamps
    end
    add_index(:equivalent_subjects, [:subject_id, :equivalent_to_id], :unique => true)
    add_index(:equivalent_subjects, :subject_id, :unique => false)
  end

  def self.down
    remove_index(:equivalent_subjects, :column => [:subject_id, :equivalent_to_id])
    remove_index(:equivalent_subjects, :column => :subject_id)
    drop_table :equivalent_subjects
  end
end
